﻿@using Sausage.Web.Models
@using Sausage.Web.DataModel
@using Telerik.Web.Mvc.UI
@using Sausage.Web.Domain
@model DictionaryItemListRow
@{
    ViewBag.Title = "突发事件发布";
    Layout = "~/Views/Shared/MainLayout.cshtml";

    //用于组织结构信息
    List<string> organizationModels = new List<string>();

    //判断当前用户是否为总段用户
    if (!Helper.CurrentPrincipal.Organization.ParentID.HasValue)
    {
        //查询所有的分段信息
        using (SausageEntities entities = new SausageEntities())
        {
            //查询所有角色信息
            foreach (Organization item in entities.Organization.Where(item => item.Category == 1).OrderBy(item => item.OrganizationCode))
            {
                //转换为字符串
                organizationModels.Add(string.Format("{{ boxLabel: \'{0} {1}\', name: 'Receivers', inputValue: '{2}' }}", item.OrganizationCode, item.OrganizationName, item.OrganizationID.ToString("D")));
            }
        }
    } 
}
@section HeadCssLink
{
    <link href="@Url.Content("~/Content/Styles/ext-patch.css")" rel="stylesheet" type="text/css" />
    <link  href="@Url.Content("~/Content/Styles/images_viewer.css")" rel="stylesheet" type="text/css" />
}
@section HeadScriptLink
{
    <script src="@Url.Content("~/Scripts/ExtJS/locale/ext-lang-zh_CN.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/model.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Sausage/Emergency/Submit.js")" type="text/javascript"></script>
    <script type="text/javascript">

        //保存会话编号
        var session_id = '@Html.Raw(Session.SessionID)';
        //保存认证编号
        var auth_id = '@Html.Raw(Request.Cookies[FormsAuthentication.FormsCookieName].Value)';

        //用于保存组织结构信息
        var master_organization =
        [
            @Html.Raw(System.String.Join(",", organizationModels))
        ];

        //用于保存文件存储
        var store_files = null;
    </script>
}
<h2>
    @ViewBag.Title
</h2>
<br />
<div id="data-grid" class="div-grid-box">
</div>
